<?php

namespace App\Models\Mileage;

use App\Models\Model;

class Mileage extends Model
{
    protected $table = 'akbus_mileage';

    protected $fillable = [
        'date',
        'team',
        'line',
        'license_plate_num',
        'self_numbering',
        'plan_times',
        'actual_times',
        'drop_off',
        'departure_rate',
        'operating_mileage',
        'non-operating_mileage',
        'gps_mileage',
        'plan_mileage',
        'rated_mileage',
    ];

    /**
     * 类型转化
     *
     * @var array
     */
    protected $casts = [
    ];

    /**
     * @param $value
     *
     * @return string
     */
    public function getDepartureRateAttribute($value)
    {
        return ($value * 100).' %';
    }

    /**
     * 拼接车牌号字符
     *
     * @param  string  $value
     *
     * @return string
     */
    public function getLicensePlateNumAttribute($value)
    {
        return '陕G'.$value;
    }
}
